package BaseClasses;

import java.io.Serializable;
import java.sql.Date;
import java.sql.Time;

/**
 * this class holds information of message that need to be approve by principal
 */
public class Message implements Serializable
{

	private static final long serialVersionUID = -2358941105315298612L;
	
	/**message text contains the meaning of the message*/
	private String MsgText;
	/**message date*/
	private Date MsgDate;
	/**message Message Time(hour,minutes,seconds)*/
	private Time MsgTime;
	/**message query,after the message is approved by the principal ,this query is sent to be execute*/
	private String MsgQuery;
	
	/**
	 * constructor 
	 * @param msg object(full in all parameter of this class)
	 */
	public Message(Message msg) 
	{
		//**Variables **//
		MsgText = new String(msg.getMsgText());
		MsgDate = new Date(msg.getMsgDate().getTime());
		MsgTime = new Time(msg.getMsgTime().getTime());
		MsgQuery = new String(msg.getMsgQuery());
	}
	
	//**Constructors **//
	/**
	 * empty constructor
	 */
	public Message()
	{
		MsgText = new String();
		MsgDate = new Date(0);
		MsgTime = null;
		MsgQuery = new String();
	}
	/**
	 * constructor
	 * @param text: message text contains the meaning of the message
	 * @param date: message date
	 * @param time: message Message Time(hour,minutes,seconds)
	 * @param query: message query,after the message is approved by the principal ,this query is sent to be execute
	 */
	public Message(String text,Date date,Time time,String query)
	{
		setMsgText(text);
		setMsgDate(date);
		setMsgTime(time.getTime());
		setMsgQuery(query);
	}
	
	
	//**Getters & Setters **//
	public String getMsgQuery() 
	{
		return new String(MsgQuery);
	}
	
	public void setMsgQuery(String msgQuery) 
	{
		MsgQuery = new String(msgQuery);
	}
	
	public Time getMsgTime() 
	{
		return MsgTime;
	}
	
	public void setMsgTime(long msgTime)
	{
		MsgTime = new Time(msgTime);
	}

	public Date getMsgDate() 
	{
		return MsgDate;
	}

	public void setMsgDate(Date msgDate) 
	{
		MsgDate = msgDate;
	}

	public String getMsgText() 
	{
		return new String(MsgText);
	}

	public void setMsgText(String msgText) 
	{
		MsgText = new String(msgText);
	}
}

